package com.zhengqing.design.structure.adapter._01.adapter;


import com.zhengqing.design.structure.adapter._01.TypeCAdaptee;
import com.zhengqing.design.structure.adapter._01.UsbTarget;

/**
 * <p> 对象适配器 </p>
 *
 * @author zhengqingya
 * @description 通过包装一个需要适配的对象，把原接口转换成目标接口
 * @date 2022/12/19 16:12
 */
public class ObjAdapter implements UsbTarget {

    private TypeCAdaptee typeCAdaptee;

    public ObjAdapter(TypeCAdaptee typeCAdaptee) {
        this.typeCAdaptee = typeCAdaptee;
    }

    @Override
    public void usb() {
        // 拿到typeC数据 做下转换处理...
        this.typeCAdaptee.typeC();
        // ...

        System.out.println("typeC -> usb");
    }
}
